function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import cloneDeep from 'lodash/cloneDeep';
export var inputPropsBasic = [{
  name: 'title',
  title: {
    label: '标题',
    tip: 'title | 标题'
  },
  setter: 'StringSetter'
}, {
  name: 'code',
  title: {
    label: '字段名',
    tip: 'key | 字段名'
  },
  setter: 'StringSetter'
}, {
  name: 'defaultValue',
  title: {
    label: '默认值',
    tip: 'defaultValue | 默认值'
  },
  setter: 'StringSetter'
}, {
  name: 'props.placeholder',
  title: {
    label: '提示文案',
    tip: 'placeholder | 提示文案'
  },
  setter: 'StringSetter'
}, {
  name: 'description',
  title: {
    label: '补充说明',
    tip: 'description | 补充说明'
  },
  setter: 'StringSetter'
}, {
  name: 'tooltip.title',
  title: {
    label: '气泡提示',
    tip: 'tooltip.title | 气泡提示文案'
  },
  setter: 'StringSetter'
}, {
  name: 'extra',
  title: {
    label: '额外提示',
    tip: 'extra | 额外的提示信息'
  },
  setter: 'StringSetter'
}, {
  name: 'disabled',
  title: {
    label: '禁用',
    tip: 'disabled | 禁用'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'hidden',
  title: {
    label: '隐藏',
    tip: 'hidden | 隐藏'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'readOnly',
  title: {
    label: '只读',
    tip: 'readOnly | 只读'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'readOnlyWidget',
  title: {
    label: '只读组件',
    tip: 'readOnlyWidget | 只读组件'
  },
  setter: 'StringSetter',
  condition: function condition(target) {
    return !!target.getProps().getPropValue('readOnly');
  }
}];
export var notInputPropsBasic = [{
  name: 'title',
  title: {
    label: '标题',
    tip: 'title | 标题'
  },
  setter: 'StringSetter'
}, {
  name: 'code',
  title: {
    label: '字段名',
    tip: 'key | 字段名'
  },
  setter: 'StringSetter'
}, {
  name: 'defaultValue',
  title: {
    label: '默认值',
    tip: 'defaultValue | 默认值'
  },
  setter: 'StringSetter'
}, {
  name: 'description',
  title: {
    label: '补充说明',
    tip: 'description | 补充说明'
  },
  setter: 'StringSetter'
}, {
  name: 'tooltip',
  title: {
    label: '气泡提示',
    tip: 'tooltip | 气泡提示文案'
  },
  setter: 'StringSetter'
}, {
  name: 'extra',
  title: {
    label: '额外提示',
    tip: 'extra | 额外的提示信息'
  },
  setter: 'StringSetter'
}, {
  name: 'disabled',
  title: {
    label: '禁用',
    tip: 'disabled | 禁用'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'hidden',
  title: {
    label: '隐藏',
    tip: 'hidden | 隐藏'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'readOnly',
  title: {
    label: '只读',
    tip: 'readOnly | 只读'
  },
  setter: 'FrExpressionSetter'
}, {
  name: 'readOnlyWidget',
  title: {
    label: '只读组件',
    tip: 'readOnlyWidget | 只读组件'
  },
  setter: 'StringSetter',
  condition: function condition(target) {
    return !!target.getProps().getPropValue('readOnly');
  }
}];
export var optionsProp = {
  display: 'accordion',
  name: 'props.options',
  title: {
    label: '选项配置',
    tip: 'options ｜ 选项配置'
  },
  setter: {
    componentName: 'ArraySetter',
    props: {
      itemSetter: {
        componentName: 'ObjectSetter',
        initialValue: function initialValue() {
          return {
            label: '选项名',
            value: uuid()
          };
        },
        props: {
          config: {
            items: [{
              name: 'label',
              title: '选项名',
              important: true,
              setter: 'StringSetter'
            }, {
              name: 'value',
              title: '选项值',
              setter: ['StringSetter', 'NumberSetter'],
              important: true
            }, {
              name: 'disabled',
              title: '禁用',
              setter: 'JsonSetter'
            }]
          }
        }
      }
    }
  }
};
export var getInputPropsBasic = function getInputPropsBasic(defaultValueProp, placeholder) {
  var result = cloneDeep(inputPropsBasic);
  result.splice(2, 0, defaultValueProp);
  if (placeholder) {
    result.splice(3, 0, defaultValueProp);
  }
  return result;
};
export var getNotInputPropsBasic = function getNotInputPropsBasic(defaultValueProp) {
  var result = cloneDeep(notInputPropsBasic);
  result.splice(2, 0, defaultValueProp);
  return result;
};
export var uuid = function uuid() {
  return (Math.random() * 1e6 >> 0).toString(36);
};
export var createMeta = function createMeta(componentName, params) {
  return _objectSpread({
    componentName: componentName,
    docUrl: '',
    screenshot: '',
    devMode: 'proCode',
    npm: {
      package: '@ali/form-render-material',
      version: '1.0.0',
      exportName: componentName,
      main: 'src/index.tsx',
      destructuring: true,
      subName: ''
    },
    configure: {
      supports: {
        loop: false,
        condition: false
      },
      component: {
        isContainer: false,
        isModal: false,
        nestingRule: {
          parentWhitelist: ['FormRender', 'Card', 'CardList', 'TableList']
        }
      }
    },
    group: '基础组件',
    category: '常用',
    icon: 'https://img.alicdn.com/imgextra/i4/O1CN01gxzRdT1hm9KXRbZkU_!!6000000004319-2-tps-200-200.png'
  }, params);
};